package Code.Test4;

import java.util.Scanner;

public class CatTest {
    public static void main(String[] args) {
        //创建数组
        Car[] arr =new Car[3];
        
        //创建汽车对象
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            Car c = new Car();
            System.out.println("请输入汽车的品牌：");
            c.setBrand(scanner.next());
            System.out.println("请输入汽车的价格：");
            c.setPrice(scanner.nextInt());
            System.out.println("请输入汽车的颜色：");
            c.setColor(scanner.next());

            arr[i] = c;
        }

        //遍历
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i].getBrand()+" "+arr[i].getPrice()+" "+arr[i].getColor());
        }



    }
}
